#include "mainwindow.hpp"

/*MainWindow::MainWindow()
{
    this->setWindowTitle("PED");

    glWidget = new GLWidget();
    this->setCentralWidget(glWidget);

    this->resize(600,600);
}*/


MainWindow::MainWindow()
{
    this->setWindowTitle("PED");

    fileMenu = this->menuBar()->addMenu(tr("&File"));

    QAction *actionLoad = new QAction("Load Model", this);
    actionLoad->setShortcut(QKeySequence("Ctrl+O"));
    fileMenu->addAction(actionLoad);

    QAction *actionExit = new QAction("Exit", this);
    actionExit->setShortcut(QKeySequence("Ctrl+Q"));
    fileMenu->addAction(actionExit);

    glWidget = new GLWidget();
    this->setCentralWidget(glWidget);

    this->resize(600,600);

    connect(actionLoad, SIGNAL(triggered()), this, SLOT(loadOBJ()));
    connect(actionExit, SIGNAL(triggered()), this, SLOT(close()));
}

void MainWindow::loadOBJ()
{
    QString fileOBJ = QFileDialog::getOpenFileName(this, "Load file", QString(), "*.obj");
    glWidget->addModel(fileOBJ);
}
